Attribute VB_Name = "Propbag"
Private Type prop
    nme As String 'name
    dat As String 'data
End Type

Dim mnsze As Long ' Maximum name size
Dim mdsze As Long ' Maximum data size
Dim cacheamo As Long 'Maximum cache size
Dim cpath As String

'TODO
'CACHING OF PROPERTIES

Public Sub Propinit()
'ReDim propstack(0)
cacheamo = 0

cpath = fpath & "Data\"
End Sub

Public Function Getprop(ByVal cnme) As String
Getprop = ""
cnme = cnme & ".txt"
If Dir(cpath & cnme) <> "" Then
    Dim fnme As Integer
    fnme = FreeFile
    Dim buff() As Byte
    Open cpath & cnme For Binary As #fnme
    If LOF(fnme) = 0 Then
        Close #fnme
        Exit Function
    End If
    ReDim buff(LOF(fnme) - 1)
    Get fnme, , buff
    Close #fnme
    Getprop = StrConv(buff, vbUnicode)
    
End If

End Function

Public Sub Setprop(ByVal cname, val)
cnme = cnme & ".txt"

Dim buff() As Byte
Dim fnme As Integer
buff = StrConv(val, vbFromUnicode)
fnme = FreeFile
Open cpath & cname For Binary As #fnme
Put fnme, , buff
Close #fnme

If val = "" Then
    Kill cpath & cname
End If
End Sub

